Posted January 10, 2016 I'd like to be able to automatically run a script after a docker container starts. How might I do that? Couple of examples of what I'd like to do: [*]change the permissions on appdata/crashplan/conf/service.model to 0666 (changed to 0600 in CP rev 4.5, creates SyncBack error) [*]create a revised appdata/crashplan/id/.ui_info with the unRAID server IP address substituted for 0.0.0.0 (broken in CP circa rev 4.1?) I don't need help creating the script(s); what I need help on is figuring out how to have the docker manager run the script(s) automatically when the container is started. Thanks in advance for your help! Like × Quote unRAID Pro 6.12.10, Supermicro X11SSM-F, Intel Xeon E3-1245v5 @ 3.5GHz, 2x8GB Crucial DDR4-2133 RAM, CM Stacker 810, 2TB Samsung EVO 850 SSD Cache, 6 Spinners + 1 Parity, APC Back-UPS XS 1200, Win11 VM with Radeon HD6450 GPU Pass-through
Posted January 10, 2016 Change the docker container itself to have that done on startup. Depending on which docker container and which base image they use will determine how to hook into that startup. You could do it on the unraid side, but why not fix what was broken where it was broken to begin with? If you're using a LinuxServer container I'm sure the fine folks there would help you out. I could also see them changing all there containers to support user adjustable startup scripts as a new feature. Like × Quote
Posted January 10, 2016 You basically put the script in your GitHub repository and then put commands like this at the end of the Dockerfile to install and run it. ADD install.sh /tmp/ RUN chmod +x /tmp/install.sh && /tmp/install.sh && rm /tmp/install.sh The above copies the script install.sh into the docker, runs it and then deletes it. But then, I'm guessing you really want to do it without creating your own repository, right? Like × Quote
Author Posted January 10, 2016 On 1/10/2016 at 1:11 AM, BRiT said: ... why not fix what was broken where it was broken to begin with? The two items I'm working on are work-arounds for changes Code42 implemented in recent revisions of CrashPlan. They have not been particularly responsive to requests for relief. You know the drill: "... running the CrashPlan service on a headless computer is an unsupported feature..." and "... security decision made by our engineers that we have no intention of reversing." Quote If you're using a LinuxServer container ... No, this is a gfjardim container Quote But then, I'm guessing you really want to do it without creating your own repository, right? Right; wasn't quite ready to take that step. I was really hoping there was a generic hook in the docker manager that would facilitate user scripts that I didn't know about. I can't believe I'm the only one that might see a use for this feature. Thanks for the ideas, guys! Like × Quote unRAID Pro 6.12.10, Supermicro X11SSM-F, Intel Xeon E3-1245v5 @ 3.5GHz, 2x8GB Crucial DDR4-2133 RAM, CM Stacker 810, 2TB Samsung EVO 850 SSD Cache, 6 Spinners + 1 Parity, APC Back-UPS XS 1200, Win11 VM with Radeon HD6450 GPU Pass-through
Posted May 15, 2017 (edited) On 5/15/2017 at 2:30 AM, Flick said: Did you ever find a way to do this? Thanks! Easiest solution would be to set the docker app to NOT autostart, then create a user script vis a vis user scripts plugin set to run at array start containing something like this: sleep xxx (xxx is however long it takes for the other containers, VMs, etc to get up and running) docker start nameOfContainer whateverOtherCommandsYouWant Edited May 15, 2017 by Squid Flick and BRiT 2 Like × Quote Sent via an NSA monitored device
Posted March 13, 2018 On 5/15/2017 at 2:58 AM, Squid said: Easiest solution would be to set the docker app to NOT autostart, then create a user script vis a vis user scripts plugin set to run at array start containing something like this: sleep xxx (xxx is however long it takes for the other containers, VMs, etc to get up and running) docker start nameOfContainer whateverOtherCommandsYouWant Although this is a cool way to have a post-startup script for the initial container launch, right after the array startup, this would not make the container restartable with the script. For example, I want to run docker network connect bridge poste right after the poste container - which is on a macvlan - starts, to add a second network to the container. However, I might want to restart / stop-start the container at runtime. I'd love to have a post-start and post-stop command (to be run on the host) option in the docker GUI. I can think of a few more examples that cannot be included in the dockerfile. Cameron and Nick_J 2 Like × Quote
Posted August 15, 2023 I just added in the "Post Arguments" box the following to install ffmpeg into the nextcloud container after it has been started: && docker exec -u root nextcloud bash -c "apt update && apt install -y ffmpeg" The "&&" causes the docker run command to finish and upon success executes what comes after it as a new command. You can put in whatever you like. Works for me, hopefully it works for others as well. But I agree that maybe another script box would be nicer and cleaner. Raboon 1 Like × Quote
Posted February 7 On 8/15/2023 at 5:08 PM, bj___ said: I just added in the "Post Arguments" box this was very helpful and works for my use case, thanks! Like × Quote